From 5c77003b524af15a4a8a9d33ba0f2786f3a31c2b Mon Sep 17 00:00:00 2001 From: Wei Liu Date: Thu, 10 Apr 2014 16:18:00 +0100 Subject: [PATCH] libxl/gentypes.py: generate empty map for None field in keyed-union Without this the generated JSON is malformed. Signed-off-by: Wei Liu Acked-by: Ian Campbell --- tools/libxl/gentypes.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tools/libxl/gentypes.py b/tools/libxl/gentypes.py index 1a3b91cf68..917e2c2572 100644 --- a/tools/libxl/gentypes.py +++ b/tools/libxl/gentypes.py @@ -220,6 +220,13 @@ def libxl_C_type_gen_json(ty, v, indent = " ", parent = None): s += "case %s:\n" % f.enumname if f.type is not None: s += libxl_C_type_gen_json(f.type, fexpr, indent + " ", nparent) + else: + s += " s = yajl_gen_map_open(hand);\n" + s += " if (s != yajl_gen_status_ok)\n" + s += " goto out;\n" + s += " s = yajl_gen_map_close(hand);\n" + s += " if (s != yajl_gen_status_ok)\n" + s += " goto out;\n" s += " break;\n" s += "}\n" elif isinstance(ty, idl.Struct) and (parent is None or ty.json_fn is None): -- 2.30.2